package com.chris.blog.service.impl;

import com.chris.blog.dao.BlogCategoryDao;
import com.chris.blog.entity.po.BlogCategoryPO;
import com.chris.blog.service.BlogCategoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BlogCategoryServiceImpl implements BlogCategoryService {

    @Resource
    private BlogCategoryDao blogCategoryDAO;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return blogCategoryDAO.deleteByPrimaryKey(id);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int insert(BlogCategoryPO record) {
        return blogCategoryDAO.insert(record);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int insertSelective(BlogCategoryPO record) {
        return blogCategoryDAO.insertSelective(record);
    }

    @Override
    public BlogCategoryPO selectByPrimaryKey(Integer id) {
        return blogCategoryDAO.selectByPrimaryKey(id);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int updateByPrimaryKeySelective(BlogCategoryPO record) {
        return blogCategoryDAO.updateByPrimaryKeySelective(record);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int updateByPrimaryKey(BlogCategoryPO record) {
        return blogCategoryDAO.updateByPrimaryKey(record);
    }

    public List<BlogCategoryPO> selectAll() {
        return blogCategoryDAO.selectAll();
    }
}
